/*
 * @(#)ObjectUtils.java   1.0   May 19, 2007
 *
 * Copyright 2000-2007 ETH Zurich. All Rights Reserved.
 *
 * This software is the proprietary information of ETH Zurich.
 * Use is subject to license terms.
 *
 * @(#) $Id$
 */
package ch.ethz.globis.javaom.utils;

import ch.ethz.globis.javaom.core.Bulk;
import ch.ethz.globis.javaom.core.Object;
import ch.ethz.globis.javaom.core.Tuple;
import ch.ethz.globis.javaom.system.Metadata;

public class ObjectUtils {

   public static Bulk getAttributeValues(final Object object) {

      // get extent of objectHasAttributeValues
      final Bulk objectHasAttributeValues = Metadata.METADATA
            .getBinaryCollectionExtent(Metadata.OBJECT_HAS_ATTRIBUTEVALUES);

      // TODO this does overflow
      // get links of argument object
      // return BinaryCollectionUtils.range(BinaryCollectionUtils.domainSingleRestriction(
      // objectHasAttributeValues, object));

      final Bulk result = new Bulk();
      Tuple tuple;
      for (Object current : objectHasAttributeValues) {
         tuple = (Tuple) current;

         if (tuple.domain().equals(object)) {
            result.add(tuple.range());
         }
      }
      return result;
   }
}
